diff --git a/javascripts/app/registration_page.ts b/javascripts/app/registration_page.ts new file mode 100644 index 00000000..ee9114c5 --- /dev/null +++ b/javascripts/app/registration_page.ts @@ -0,0 +1,5 @@ +// License: LGPL-3.0-or-later + +// require a root component here. This will be treated as the root of a webpack package + +import "../src/components/registration_page/registration_page" \ No newline at end of file diff --git a/javascripts/src/components/registration_page/registration_page.spec.ts b/javascripts/src/components/registration_page/registration_page.spec.ts new file mode 100644 index 00000000..f7c24ef6 --- /dev/null +++ b/javascripts/src/components/registration_page/registration_page.spec.ts @@ -0,0 +1,10 @@ +// License: LGPL-3.0-or-later +import * as React from 'react'; +import 'jest'; +import * as Component from './registration_page' + +describe('RegistrationPage', () => { + test('your test here', () => { + expect(false).toBe(true) + }) +}) \ No newline at end of file diff --git a/javascripts/src/components/registration_page/registration_page.tsx b/javascripts/src/components/registration_page/registration_page.tsx new file mode 100644 index 00000000..c8625c79 --- /dev/null +++ b/javascripts/src/components/registration_page/registration_page.tsx @@ -0,0 +1,14 @@ +// License: LGPL-3.0-or-later +import * as React from 'react'; + +export interface RegistrationPageProps +{ + +} + +export default class RegistrationPage extends React.Component { + render() { + return
; + } +} + diff --git a/webpack.common.js b/webpack.common.js index f9db2e43..2c028878 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -11,6 +11,8 @@ const config_button=require('./config/settings.json'); const sourcePath = path.join(__dirname, 'client'); const buildPath = path.join(__dirname, 'public/client'); const translationPath = path.join(__dirname, 'public/javascripts/_final.js') +const reactEntrySourcePath = path.join(__dirname, 'javascripts') +const reactEntryOutputPath = path.join(__dirname, 'public') var common_rules= [ @@ -33,6 +35,7 @@ var common_rules= [ }, "babel-loader"] }, + { test: /\.tsx?$/, loader:"ts-loader"}, { test: /\.js$/, exclude: /node_modules|froala/, loader: "babel-loader" }, { test: /\.es6$/, exclude: /node_modules/, loader: "babel-loader" } ] @@ -47,14 +50,8 @@ module.exports = { filename: '[name].js' }, plugins: [ - new CleanWebpackPlugin([path.resolve(buildPath, 'js')]), - new ProvidePlugin({ - // $: ['jquery'], - // '$.cookie': 'jquery.cookie', - // jQuery: ['jquery', 'jquery.cookie'], - // 'jQuery.cookie': 'jquery.cookie' - }) - ] + new CleanWebpackPlugin([path.resolve(buildPath, 'js')]) + ] } , // translations: { @@ -119,7 +116,21 @@ module.exports = { new ExtractTextPlugin('page.css'), new CleanWebpackPlugin([path.resolve(buildPath, 'css')]) ] + }, + react: { + module:{ + rules: common_rules + }, + entry: WebpackSweetEntry(path.resolve(reactEntrySourcePath, "app/*.ts"), 'ts', 'app'), + output: { + path: path.resolve(reactEntryOutputPath, 'app'), + filename: '[name].js' + }, + resolve: { + extensions: [".ts", ".tsx", ".js", ".json"], + }, + plugins: [ + new CleanWebpackPlugin([path.resolve(reactEntryOutputPath, 'app')]) + ] } - - } diff --git a/webpack.debug.js b/webpack.debug.js index 3fb55c54..4c082a1d 100644 --- a/webpack.debug.js +++ b/webpack.debug.js @@ -7,9 +7,11 @@ var common_stuff = { } module.exports = [ - merge(common.base, common_stuff), merge(common.translations, common_stuff), + merge(common.base, common_stuff), + merge(common.button, common_stuff), - merge(common.css, common_stuff) + merge(common.css, common_stuff), + merge(common.react, common_stuff), ] diff --git a/webpack.production.js b/webpack.production.js index 4ace5045..7e910c87 100644 --- a/webpack.production.js +++ b/webpack.production.js @@ -14,8 +14,9 @@ const common_stuff = { } module.exports = [ - merge(common.base, common_stuff), merge(common.translations, common_stuff), + merge(common.base, common_stuff), merge(common.button, common_stuff), - merge(common.css, common_stuff) + merge(common.css, common_stuff), + merge(common.react, common_stuff), ]